#!/usr/bin/env python
#-*-encoding:utf-8-*-
'''
Created on 2015年11月5日

@author: chenyongbing
'''
import sys,os
#current_dir = os.path.dirname(__file__)
current_dir = os.path.split(os.path.realpath(__file__))[0]


from datetime import datetime,timedelta
st = '2015-01-01'
et = '2015-11-04'

while st<=et:

    query = 'LOAD DATA LOCAL INPATH "%s/%s" OVERWRITE INTO TABLE %s PARTITION(d="%s")'%('/data/java/data/role',st,'hivehistoryrole',st)
    hiveCmd = "/data/ZmHadoop/apache-hive-0.13.0-bin/bin/hive -e '%s'"%query
    print hiveCmd
    stday=datetime.strptime(st,'%Y-%m-%d')+timedelta(1)
    
    st=stday.strftime('%Y-%m-%d')

    